#include <stdio.h>
int main_012(void) {
	int i, j, k;
	int a, count = 0;
	scanf_s("%d", &a);
	i = a;
	while (i <= a + 3) {
		j = a;
		while (j <= a + 3) {
			k = a;
			while (k <= a + 3) {
				if (i != j && j != k && i != k) {
					printf("%d%d%d",i ,j ,k);
					count++;
					if (count == 6 ) {
						printf("\n");
						count = 0;
					}
					else {
						printf(" ");
					}
				}
				k++;
			}
			j++;
		}
		i++;
	}
	return 0;
}